{% extends "overview/base.html" %}

{% block external %}
  {% load static %}
  <link rel="stylesheet" type="text/css" href="{% static 'css/users/login.css' %}"/>
{% endblock %}

{% block title %}
	登录
{% endblock %}

{% block main %}
  <div id="login" class="container">
    <div class="row">
      <div class="col-sm-4 col-sm-offset-4">
        <form class="login-box" role="form" action="{% url 'users:login' %}" method="post">
          <!--防恶意攻击-->
          {% csrf_token %}
          <!--开头的登录-->
          <div class="text-center">
            <h3>~登录~</h3>
          </div>
          <hr/>
          <!--用户名-->
          <!--用户名出错-->
          {% if username_error %}
            <div class="input-group has-error">
              <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
              <input type="text" name="username" class="form-control" placeholder="用户名" value="{{ username }}"/>
            </div>
            <p class="text-danger small">*{{ username_error }}</p>
          {% else %}
            <div class="input-group">
              <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
              <input type="text" name="username" class="form-control" placeholder="用户名" value="{{ username }}"/>
            </div>
          {% endif %}
          <br/>
          <!--密码-->
          <!--密码错误-->
          {% if password_error %}
            <div class="input-group has-error">
              <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
              <input type="password" name="password" class="form-control" placeholder="密码" value="{{ password }}"/>
            </div>
            <p class="text-danger small">*{{ password_error }}</p>
          {% else %}
            <div class="input-group">
              <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
              <input type="password" name="password" class="form-control" placeholder="密码" value="{{ password }}"/>
            </div>
          {% endif %}
          <hr/>
          <!--忘记密码-->
          <div class="text-center">
            <a href="{% url 'users:retrieve-username' %}">忘记密码？</a>
          </div>
          <br/>
          <!--登录按钮-->
          <button type="submit" class="btn btn-primary btn-block">登录</button>
        </form>
      </div>
    </div>
  </div>
{% endblock %}

<!--取消页脚-->
{% block footer %}
  <hr/>
  <p class="text-center">@</p>
{% endblock %}